<?php
	//----------------------- INPUT ELEMENTS -------------------//
	$ssFilter 		= $this->arrParam['ssFilter'];
	$selectLanguages = $ssFilter['lang_code'] . $this->formHidden('lang_code',$ssFilter['lang_code']);
	$name 			= $this->formText ( 'name', $this->Item['name'], array ('class' => 'txtlong active', 'onchange'=>"get_alias()") );
	$picture		= '<div><img src="' . $this->imgUrl . '/no-avatar.png" id="image_picture" class="hinh-anh"></div>';
	if(!empty($this->Item['picture'])){
		$picture		= '<div><img src="' . $this->Item['picture'] . '" id="image_picture" class="hinh-anh"></div>';
	}
	$picture 		= $this->cmsUserFiles('picture', $this->Item['picture'], 'Chọn ảnh', 'images', $options = array('class' => 'txtfile') ) . $picture;
	$option 		= array('Không','Có');
	if(isset($this->Item['status'])){
		$trangthai = $this->Item['status'];
	}else{
		$trangthai = 1;
	}
	$status 		= $this->formRadio('status',$trangthai,null,$option, ' ');
	
	if(isset($this->Item['order'])){
		$order = $this->Item['order'];
	}else{
		$order = 255;
	}
	$order 			= $this->formText ('order', $order, array ('class' => 'txtshort' ) );
	$parents		= $this->cmsSelect('parents',$this->Item['parents'],$this->slbCategory,array('style'=>'min-width:200px;'));
	$content 		= $this->cmsEditor('content',htmlspecialchars_decode($this->Item['content']),array('toolbar'=>'MyToolbar', 'language'=>'vi'));
	
	$arrInput = array(
				array('label' => 'Chọn ngôn ngữ','input' => $selectLanguages),
				array('label' => 'Tên danh mục','input' => $name),
				array('label' => 'Hình ảnh','input' => $picture),
				array('label' => 'Thuộc danh mục','input' => '<div id="category">' . $parents . '</div>'),
				array('label' => 'Hiển thị','input' => $status),
				array('label' => 'Thứ tự','input' => $order),
				array('label' => 'Nội dung','input' => $content, 'cols' => 2,'style' => 'padding-top:0;'),
			);
	
	//--------------------- Blocks ---------------------
	$option 			= array('Không','Có');
	if(isset($this->Item['block_left'])){
		$trangthai = $this->Item['block_left'];
	}else{
		$trangthai = 0;
	}
	$blockLeft		= $this->formRadio('block_left',$trangthai,null,$option, ' ');
	
	if(isset($this->Item['block_right'])){
		$trangthai = $this->Item['block_right'];
	}else{
		$trangthai = 0;
	}
	$blockRight			= $this->formRadio('block_right',$trangthai,null,$option, ' ');
	
	if(isset($this->Item['block_body'])){
		$trangthai = $this->Item['block_body'];
	}else{
		$trangthai = 0;
	}
	$blockBody			= $this->formRadio('block_body',$trangthai,null,$option, ' ');
	
	$arrBlock = array(
			array('label' => 'Cột trái','input' => $blockLeft),
			array('label' => 'Cột phải','input' => $blockRight),
			array('label' => 'Trang chủ','input' => $blockBody),
	);

	//--------------------- Meta Options ---------------------
	$alias 				= $this->formText ( 'alias', $this->Item['alias'], array ('class' => 'textlong' ) );
	$tags		 		= $this->formTextarea('tags',$this->Item['tags'],array('rows'=>2,'class' => 'txtalong'));
	$meta_title 		= $this->formTextarea('meta_title',$this->Item['meta_title'],array('rows'=>2,'class' => 'txtalong'));
	$meta_description 	= $this->formTextarea('meta_description',$this->Item['meta_description'],array('rows'=>3,'class' => 'txtalong'));
	$meta_keywords 		= $this->formTextarea('meta_keywords',$this->Item['meta_keywords'],array('rows'=>3,'class' => 'txtalong'));
	
	$arrMeta = array(
			array('label' => 'Liên kết tĩnh','input' => $alias),
			array('label' => 'Meta Title','input' => $meta_title),
			array('label' => 'Meta Description','input' => $meta_description),
			array('label' => 'Meta Keywords','input' => $meta_keywords),
		);
	
	//-------------------- SESSAGES ERROR ------------------
	if(count($this->messageError)>0){
		$errors = $this->formErrors($this->messageError,array('id'=>'errors'));
	}
?>
<form name="appForm" method="post" action="" enctype="multipart/form-data">
	<?php echo $this->render('admin-category/toolbar/index.php');?>
 	<div class="clr"></div>
	<?php echo $this->render('admin-category/sublink/index.php');?>
	<?php echo $errors;?>

	<!-- BEGIN: CONTENT -->
	<div class="app_content goc10">
		<div class="width-60 fl">
			<fieldset class="adminform">
				<legend>Chi tiết</legend>
				<table class="adminformlist">
					<?php echo $this->partialLoop('row.php', $arrInput);?>
				</table>
			</fieldset>
		</div>
		<div class="width-40 fr">
			<div id="pane-sliders" class="pane-sliders">
				
				<div class="panel">
					<h3 id="metadata-options" class="title pane-toggler-down"><a href="javascript:void(0);"><span>Danh mục thuộc các block</span></a></h3>
					<div class="panel_content">
						<fieldset class="panelform">
							<table class="panelformlist">
								<?php echo $this->partialLoop('row.php', $arrBlock);?>
							</table>
						</fieldset>
					</div>
				</div>
				
				<div class="panel">
					<h3 id="metadata-options" class="title pane-toggler-down"><a href="javascript:void(0);"><span>Metadata Options</span></a></h3>
					<div class="panel_content">
						<fieldset class="panelform">
							<table class="panelformlist">
								<?php echo $this->partialLoop('row.php', $arrMeta);?>
							</table>
						</fieldset>
					</div>
				</div>
					
			</div>
		</div>
		<div class="clr"></div>
	</div>
	<!-- END: 	CONTENT -->
</form>